<?php session_start(); ?>
<?php
function __autoload($class_name) {
    include '../class/' . $class_name . '.php';
}
?>
<?php include("functions.php"); ?>
<?php include("connection.php"); ?>
<?php $settings = new Settings(); ?>
<?php
	if(isset($_POST['userName']) && isset($_POST['userPassword'])) {
		try {
			$params = "";
			$user = new User();			
			switch($user->logIn($_POST['userName'], $_POST['userPassword'])) { 
				case "pass": $params = "2"; break;
				case "user": $params = "3"; break;
			}
		}
		catch(Exception $e) {
			echo "Exception appeared: ", $e->getMessage(), "\n";
		}
	}
	header("Location: ". $settings->base ."games/" . $params);
	
?>